from core.basehandler import BaseHandler
from core.room import Room
from core.support import set_cutscene, get_game
from core.action import Action

class Breadwinners(Room):
    def __init__(self, room_id ):
        Room.__init__(self, room_id)    # do basic initialization for every room
        self.using_stilts = False
        # add inventory items
        
        # build list of actions
        self.add_action(Fight)
        self.add_action(Exit)
    
    # return description of room.
    def get_description(self):
        if self.using_stilts:
            return "These magic stilts allow you to walk above the Undergrads and you get to cut the line and get your purchases in no time."
        else:
            return "The room is full of Undergrads!! How do you get through?"
    
    # return image of room
    def get_image(self):
        return 'Breadwinners.jpg'
    
    # report whether this room is illuminated
    # which can happen if the room or player has a lit lamp  
    def use_stilts(self):
        self.add_action(Skip)


class BreadwinnersHandler(BaseHandler):
    
    # return class to use to create a new instance of this room
    def get_room_class(self):
        return Breadwinners
    
class Fight(Action):
    def __init__(self):
        Action.__init__(self, "Fight")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Push your way through the Undergrads!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'secondFloorArena'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"


class Exit(Action):
    def __init__(self):
        Action.__init__(self, "Exit")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Turn around and run!"
    
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'secondFloor'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"

class Skip(Action):
    def __init__(self):
        Action.__init__(self, "Skip")    # do basic initialization for every action
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Leave"

    # set cutscene for when arrive in entrance_hall
    def do_action(self,game,room,request):
        set_cutscene("You leave the room and find yourself in a treasure room.")
        return
        
    # return id of room to enter when action is complete
    def get_destination(self):
        return 'secondFloorTreasure'
    
    # return http method to use when user clicks on this action
    # use "get" if just moving to another room.  if changing something
    # like the state of an inventory item or room then use "post"
    def get_method(self):
        return "get"    